package io_0929;


import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 使用Scanner
 * User: 86187
 * Date: 2022-10-07
 * Time: 22:01
 */
public class Demo4 {
    public static void main(String[] args) throws IOException {

        InputStream inputStream = new FileInputStream("./test.txt");
        // 使用Scanner 读文本文件
        Scanner scanner = new Scanner(inputStream);

        while(scanner.hasNext()) {
            System.out.println(scanner.next());
        }

        inputStream.close();
    }
}
